load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("scm_client_infra")

cpp_library(
    name = "fs_channel",
    headers = ["FsChannel.h"],
    exported_deps = [
        "//eden/common/utils:immediate_future",
        "//eden/fs/privhelper:interface",
        "//eden/fs/utils:fs_channel_types",
        "//eden/fs/utils:request_permit_vendor",
    ],
)

cpp_library(
    name = "inode_number",
    headers = ["InodeNumber.h"],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly/logging:logging",
    ],
)

cpp_library(
    name = "request_context",
    srcs = ["RequestContext.cpp"],
    headers = ["RequestContext.h"],
    deps = [
        "//eden/common/utils:system_error",
        "//eden/fs/telemetry:log_info",
        "//folly/logging:logging",
    ],
    exported_deps = [
        "//eden/common/telemetry:structured_logger",
        "//eden/common/telemetry:telemetry",
        "//eden/fs/store:context",
        "//eden/fs/telemetry:stats",
        "//eden/fs/utils:process_access_log",
        "//folly/futures:core",
    ],
)

cpp_library(
    name = "inode_catalog",
    headers = ["InodeCatalog.h"],
    exported_deps = [
        ":inode_number",
        "//eden/common/utils:bug",
        "//eden/common/utils:immediate_future",
        "//eden/common/utils:path",
        "//eden/fs/inodes/overlay:overlay_checker_util",
        "//eden/fs/inodes/overlay:serialization-cpp2-types",
        "//eden/fs/model:model",
    ],
)

cpp_library(
    name = "file_content_store",
    headers = ["FileContentStore.h"],
    exported_deps = [
        ":inode_number",
        "//eden/common/utils:path",
        "//folly:range",
    ],
)

cpp_library(
    name = "inodes",
    srcs = [
        "CheckoutAction.cpp",
        "CheckoutContext.cpp",
        "DeferredDiffEntry.cpp",
        "DirEntry.cpp",
        "EdenDispatcherFactory.cpp",
        "EdenMount.cpp",
        "EdenMountHandle.cpp",
        "FileInode.cpp",
        "FuseDispatcherImpl.cpp",
        "GlobNode.cpp",
        "InodeAccessLogger.cpp",
        "InodeBase.cpp",
        "InodeError.cpp",
        "InodeMap.cpp",
        "InodePtr.cpp",
        "NfsDispatcherImpl.cpp",
        "Overlay.cpp",
        "OverlayFile.cpp",
        "OverlayFileAccess.cpp",
        "PathError.cpp",
        "PrjfsDispatcherImpl.cpp",
        "ServerState.cpp",
        "Traverse.cpp",
        "TreeInode.cpp",
        "TreePrefetchLease.cpp",
        "VirtualInode.cpp",
    ],
    headers = [
        "CacheHint.h",
        "CheckoutAction.h",
        "CheckoutContext.h",
        "DeferredDiffEntry.h",
        "DirEntry.h",
        "EdenDispatcherFactory.h",
        "EdenMount.h",
        "EdenMountError.h",
        "EdenMountHandle.h",
        "FileInode.h",
        "FuseDispatcherImpl.h",
        "GlobNode.h",
        "InodeAccessLogger.h",
        "InodeBase.h",
        "InodeError.h",
        "InodeMap.h",
        "InodePtr.h",
        "InodePtr-defs.h",
        "InodePtrFwd.h",
        "InodeTable.h",
        "NfsDispatcherImpl.h",
        "Overlay.h",
        "OverlayFile.h",
        "OverlayFileAccess.h",
        "ParentInodeInfo.h",
        "PathError.h",
        "PrjfsDispatcherImpl.h",
        "ServerState.h",
        "Traverse.h",
        "TreeInode.h",
        "TreePrefetchLease.h",
        "UnmaterializedUnloadedBlobDirEntry.h",
        "VirtualInode.h",
        "VirtualInodeLoader.h",
    ],
    os_deps = [
        (
            "linux",
            [
                "//eden/fs/inodes/lmdbcatalog:buffered_lmdb_inode_catalog",
                "//eden/fs/inodes/lmdbcatalog:lmdb_inode_catalog",
                "//eden/fs/inodes/lmdbcatalog:lmdb_file_content_store",
                "//eden/fs/inodes/fscatalog:fsinodecatalog",
            ],
        ),
        (
            "macos",
            [
                "//eden/fs/inodes/lmdbcatalog:buffered_lmdb_inode_catalog",
                "//eden/fs/inodes/lmdbcatalog:lmdb_inode_catalog",
                "//eden/fs/inodes/lmdbcatalog:lmdb_file_content_store",
                "//eden/fs/inodes/fscatalog:fsinodecatalog",
            ],
        ),
    ],
    deps = [
        "fbsource//third-party/cpptoml:cpptoml",
        "fbsource//third-party/fmt:fmt",
        "fbsource//third-party/re2:re2",
        ":file_content_store",
        "//eden/common/telemetry:log_info",
        "//eden/common/telemetry:structured_logger_factory",
        "//eden/common/utils:enum",
        "//eden/common/utils:errno_utils",
        "//eden/common/utils:fault_injector",
        "//eden/common/utils:match",
        "//eden/common/utils:process",
        "//eden/common/utils:synchronized",
        "//eden/common/utils:system_error",
        "//eden/fs/digest:blake3_hash",
        "//eden/fs/inodes/memcatalog:meminodecatalog",
        "//eden/fs/inodes/sqlitecatalog:bufferedsqliteinodecatalog",
        "//eden/fs/inodes/sqlitecatalog:sqliteinodecatalog",
        "//eden/fs/nfs:dirlist",
        "//eden/fs/nfs:nfs_server",
        "//eden/fs/nfs:nfs_utils",
        "//eden/fs/nfs:nfsd3",
        "//eden/fs/nfs:nfsd_rpc",
        "//eden/fs/service:pretty_printers",
        "//eden/fs/service:thrift_util",
        "//eden/fs/sqlite:sqlite",
        "//eden/fs/store:backing_store_interface",
        "//eden/fs/telemetry:file_access_structured_logger",
        "//eden/fs/telemetry:fs_event_logger",
        "//eden/fs/telemetry:log_info",
        "//eden/fs/telemetry:task_trace",
        "//eden/fs/utils:clock",
        "//eden/fs/utils:eden_error",
        "//eden/fs/utils:file_hash",
        "//eden/fs/utils:fs_channel_types",
        "//eden/fs/utils:nfs_socket",
        "//folly:exception",
        "//folly:fbstring",
        "//folly:file_util",
        "//folly:likely",
        "//folly:random",
        "//folly:string",
        "//folly:unit",
        "//folly/chrono:conv",
        "//folly/io:iobuf",
        "//folly/io/async:async_base",
        "//folly/portability:openssl",
        "//folly/system:pid",
        "//folly/system:thread_name",
        "//thrift/lib/cpp2/protocol:protocol",
    ],
    exported_deps = [
        ":fs_channel",
        ":inode_metadata",
        ":inode_number",
        "//eden/common/telemetry:structured_logger",
        "//eden/common/telemetry:telemetry",
        "//eden/common/utils:bug",
        "//eden/common/utils:case_sensitivity",
        "//eden/common/utils:file_utils",
        "//eden/common/utils:immediate_future",
        "//eden/common/utils:path",
        "//eden/common/utils:ref_ptr",
        "//eden/common/utils:string",
        "//eden/common/utils:user_info",
        "//eden/common/utils:utils",
        "//eden/fs/config:config",
        "//eden/fs/fuse:fuse",
        "//eden/fs/inodes/fscatalog:fsinodecatalog",
        "//eden/fs/inodes/fscatalog_dev:fsinodecatalog_dev",
        "//eden/fs/inodes/overlay:overlay_checker",
        "//eden/fs/inodes/overlay:serialization-cpp2-types",
        "//eden/fs/journal:journal",
        "//eden/fs/model:model",
        "//eden/fs/model:model-fwd",
        "//eden/fs/model/git:gitignore",
        "//eden/fs/nfs:dispatcher",
        "//eden/fs/privhelper:interface",
        "//eden/fs/prjfs:prjfs",
        "//eden/fs/service:thrift-cpp2-types",
        "//eden/fs/store:context",
        "//eden/fs/store:store",
        "//eden/fs/takeover:serialization-cpp2-types",
        "//eden/fs/takeover:takeover",
        "//eden/fs/telemetry:activity_buffer",
        "//eden/fs/telemetry:activity_recorder",
        "//eden/fs/telemetry:stats",
        "//eden/fs/utils:bufvec",
        "//eden/fs/utils:glob",
        "//eden/fs/utils:static_assert",
        "//folly:cancellation_token",
        "//folly:exception_wrapper",
        "//folly:expected",
        "//folly:fbvector",
        "//folly:file",
        "//folly:map_util",
        "//folly:portability",
        "//folly:range",
        "//folly:shared_mutex",
        "//folly:stop_watch",
        "//folly:synchronized",
        "//folly:thread_local",
        "//folly/concurrency/memory:read_mostly_shared_ptr",
        "//folly/container:evicting_cache_map",
        "//folly/functional:invoke",
        "//folly/futures:core",
        "//folly/futures:shared_promise",
        "//folly/logging:logging",
        "//folly/portability:sys_uio",
        "//folly/synchronization:baton",
        "//folly/synchronization:lifo_sem",
    ],
    external_deps = [
        ("boost", None, "boost_filesystem"),
        "boost",
        "gflags",
    ],
    exported_external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "inode_metadata",
    srcs = [
        "InodeMetadata.cpp",
        "InodeTimestamps.cpp",
    ],
    headers = [
        "InodeMetadata.h",
        "InodeTimestamps.h",
    ],
    deps = [
        "//eden/common/utils:throw",
        "//eden/fs/utils:clock",
        "//eden/fs/utils:fs_channel_types",
        "//folly:conv",
    ],
    exported_deps = [
        "//eden/common/utils:utils",
        "//folly/portability:sys_stat",
        "//folly/portability:sys_types",
    ],
    exported_external_deps = [
        ("glibc", None, "rt"),
    ],
)
